cmake_minimum_required(VERSION 3.13)
project(vvxfce4-power-manager)


add_definitions(-DBACKEND_TYPE_LINUX=1)

set(IS_ALONE_COMPILE TRUE)
if (NOT ${CMAKE_CURRENT_SOURCE_DIR} STREQUAL ${CMAKE_SOURCE_DIR})
       set(IS_ALONE_COMPILE FALSE)
endif()

find_package(PkgConfig)
if (${IS_ALONE_COMPILE})
pkg_check_modules(GLIB IMPORTED_TARGET glib-2.0)
pkg_check_modules(GOBJECT IMPORTED_TARGET gobject-2.0)
pkg_check_modules(GIO IMPORTED_TARGET gio-2.0)
pkg_check_modules(GIO_UNIX IMPORTED_TARGET gio-unix-2.0)
pkg_check_modules(GTHREAD IMPORTED_TARGET gthread-2.0)
pkg_check_modules(GMODULE IMPORTED_TARGET gmodule-2.0)
pkg_check_modules(GTK IMPORTED_TARGET gtk+-3.0)
pkg_check_modules(XFCE4_UI IMPORTED_TARGET libxfce4ui-2)
pkg_check_modules(XFCE4_UTIL IMPORTED_TARGET libxfce4util-1.0)
pkg_check_modules(XFCONF IMPORTED_TARGET libxfconf-0)
pkg_check_modules(WNCK IMPORTED_TARGET libwnck-3.0)
pkg_check_modules(DBUS IMPORTED_TARGET dbus-1)
endif()
pkg_check_modules(DBUS_GLIB IMPORTED_TARGET dbus-glib-1)
pkg_check_modules(UPOWER_GLIB IMPORTED_TARGET upower-glib)
pkg_check_modules(NOTIFY IMPORTED_TARGET libnotify)
pkg_check_modules(X11 IMPORTED_TARGET x11)
pkg_check_modules(XEXT IMPORTED_TARGET xext)
pkg_check_modules(XRANDR IMPORTED_TARGET xrandr)
pkg_check_modules(XCB_DPMS IMPORTED_TARGET xcb-dpms)

#if BUILD_PANEL_PLUGINS
#plugins_dir = panel-plugins
#endif
#
#SUBDIRS =        	\
#	data		\
#	libdbus		\
#	common		\
#	src		\
#	settings	\
#	$(plugins_dir) \
#	po
#

add_library(vvxpm-macros-interface
        INTERFACE
)


target_compile_definitions(vvxpm-macros-interface
        INTERFACE
        PACKAGE="${PROJECT_NAME}"
        PACKAGE_NAME="${PROJECT_NAME}"
        VERSION="${PROJECT_VERSION}"
        PACKAGE_VERSION="${PROJECT_VERSION}"
        # ICEAUTH_CMD="${ICEAUTH_CMD}"
        # REVISION="${PROJECT_VERSION}"
        # DATADIR="${CMAKE_INSTALL_DATADIR}"
        # SYSCONFDIR="${CMAKE_INSTALL_SYSCONFDIR}"
        GETTEXT_PACKAGE="${PROJECT_NAME}"
        # PACKAGE_LOCALE_DIR="${CMAKE_INSTALL_PREFIX}/share/locale"
        # PACKAGE_NAME="${PACKAGE}"
        # HELPERDIR="${CMAKE_INSTALL_PREFIX}/lib" #default
        # PACKAGE_DATADIR="${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}"
        # G_LOG_DOMAIN="${PROJECT_NAME}"
        # DBUS_API_SUBJECT_TO_CHANGE
        # WNCK_I_KNOW_THIS_IS_UNSTABLE
        # UPOWER_ENABLE_DEPRECATED
        # PACKAGE_BUGREPORT="https://gitlab.xfce.org/xfce/xfce4-session"

        LOCALEDIR="${CMAKE_INSTALL_PREFIX}/share/locale"
        G_LOG_DOMAIN="vvxfce4-power-manager"
        # SYSCONFDIR="${CMAKE_INSTALL_PREFIX}/etc"
        SYSCONFDIR="/etc"
        SBINDIR="${CMAKE_INSTALL_PREFIX}/sbin"
        UPOWER_ENABLE_DEPRECATED
        XFPM_SUSPEND_HELPER_CMD="${CMAKE_INSTALL_PREFIX}/bin/vvxfce4-pm-helper"
        # -UXFCE_PLUGIN                           \
        XFPM_SYSTRAY
)


add_subdirectory(libdbus)
add_subdirectory(common)
add_subdirectory(src)
if (${IS_ALONE_COMPILE})
#add_subdirectory(settings)
endif()

#
#EXTRA_DIST = 			\
#	TODO			\
#	README.md        \
#	intltool-extract.in 	\
#	intltool-merge.in 	\
#	intltool-update.in
#
#DISTCLEANFILES = \
#	intltool-extract \
#	intltool-merge \
#	intltool-update \
#	po/.intltool-merge-cache.lock
#
#
#distuninstallcheck_listfiles = 						\
#	find . -type f -print | grep -v ./share/icons/hicolor/icon-theme.cache
#
#.PHONY: ChangeLog
#
#ChangeLog: Makefile
#	(GIT_DIR=$(top_srcdir)/.git git log > .changelog.tmp \
#	&& mv .changelog.tmp ChangeLog; rm -f .changelog.tmp) \
#	|| (touch ChangeLog; echo 'Git directory not found: installing possibly empty changelog.' >&2)
#
#dist-hook: ChangeLog
#
#distclean-local:
#	rm -rf *.cache
#
#dist-bz2: dist
#	zcat $(PACKAGE)-$(VERSION).tar.gz | \
#	bzip2 --best -c > $(PACKAGE)-$(VERSION).tar.bz2
#
#distcheck-bz2: distcheck
#	zcat $(PACKAGE)-$(VERSION).tar.gz | \
#	bzip2 --best -c > $(PACKAGE)-$(VERSION).tar.bz2
#
#snapshot: dist
#	mv $(PACKAGE)-$(VERSION).tar.gz \
#	$(PACKAGE)-$(VERSION)-r@REVISION@.tar.gz
#
#snapshot-bz2: dist-bz2
#	mv $(PACKAGE)-$(VERSION).tar.bz2 \
#	$(PACKAGE)-$(VERSION)-r@REVISION@.tar.bz2
